home *** CD-ROM | disk | FTP | other *** search
/ Aminet 15 / Aminet 15 - Nov 1996.iso / Aminet / dev / misc / GMSV03B.lha / GamesMaster / Source / E / ScreenDemos / WideScroll&Sprite.e < prev   
Encoding:
Text File  |  1996-09-12  |  3.4 KB  |  100 lines

  1. /* Horizontal Scroll 640
  2. ** ---------------------
  3. ** This opens an extra wide screen of 256x640 pixels, and hardware scrolls
  4. ** left and right.  This is *totally* inadequate for platformers, shoot'em-ups
  5. ** etc because the picture size takes up huge amounts of memory.  However for
  6. ** games like Skidmarks, Lemmings, Monkey Island, etc, such large screens can
  7. ** be a necessity.
  8. */
  9.  
  10. MODULE 'games','games/games','exec/memory'
  11.  
  12. PROC main()
  13.    DEF screen:PTR TO gamescreen, palette:PTR TO INT, direction=1:LONG,
  14.        sparkie:PTR TO sprite, zbxy:LONG, timer:LONG, loadpic:PTR TO picture
  15.  
  16.    palette := [ $0000,$0400,$0501,$0501,$0601,$0701,$0701,$0801,
  17.         $0901,$0A01,$0B02,$0432,$0CC0,$0F00,$0211,$0880,
  18.         $01C2,$0050,$0B0B,$0606,$0F20,$0910,$0BBB,$0FFF,
  19.         $00BF,$0068,$0568,$09BF,$0FF0,$0EE0,$0BA0,$0540
  20.           ]:INT;
  21.  
  22.    screen :=  [    GSV1,0,
  23.         0,0,0,                -> Screen_Mem1/2/3
  24.         0,                    -> Screen link.
  25.         palette,              -> Address of palette.
  26.         0,                    -> Address of rasterlist.
  27.         32,                   -> Amt of colours in palette.
  28.         320,256,640,256,      -> Screen & Pic Height/Width
  29.         4,                    -> Amt of planes.
  30.         0,0,                  -> X/Y screen offsets
  31.         0,0,                  -> X/Y picture offsets.
  32.         HSCROLL OR SPRITES OR
  33.           NOSPRBDR,           -> Special attributes.
  34.         LORES,                -> Screen mode.
  35.         INTERLEAVED,          -> Screen type
  36.         0                     -> Reserved.               
  37.           ]:gamescreen;    
  38.  
  39.    sparkie := [    SPV1,0,         -> Version number
  40.         0,              -> Bank Number 0
  41.         0,              -> Ptr to graphic
  42.         150,150,        -> Beginning X/Y positions
  43.         0,              -> Current frame
  44.         16,21,          -> Width, Height
  45.         16,             -> Amt of colours
  46.         16,             -> Colour start in palette
  47.         2,              -> Amt of planes
  48.         LORES OR XLONG, -> Resolution attributes
  49.         0,              -> Position in relation to playfields
  50.         0,0             -> Private
  51.           ]:sprite;
  52.  
  53.    loadpic := [    PCV1,0,             -> Version header.
  54.         0,                  -> Destination.
  55.         640,256,            -> Width, Height.
  56.         5,                  -> Amount of Planes.
  57.         16,                 -> Amount of colours.
  58.         palette,            -> Palette (remap).
  59.         LORES,              -> Screen mode.
  60.         INTERLEAVED,        -> Destination.
  61.         0                   -> Parameters.
  62.               ]:picture;
  63.  
  64.    IF gmsbase := OpenLibrary('games.library',0)
  65.     SetUserPri()
  66.     IF (Add_Screen(screen) = ERR_OK)
  67.      loadpic.data := screen.memptr1;
  68.      IF (LoadPic('GAMESLIB:data/IFF.Pic640x256',loadpic) = ERR_OK)
  69.       sparkie.data := SmartLoad('GAMESLIB:data/sparkie.raw',0,0,MEMF_CHIP)
  70.       IF (sparkie.data)
  71.        Show_Screen(screen)
  72.        Init_Sprite(screen,sparkie)
  73.        Update_Sprite(screen,sparkie)
  74.        zbxy := Read_Mouse(JPORT1)
  75.  
  76.        REPEAT
  77.          zbxy := Read_Mouse(JPORT1)
  78.      IF (timer++ AND $1)
  79.         IF (sparkie.frame = 5) THEN sparkie.frame := 0 ELSE sparkie.frame := sparkie.frame+1
  80.      ENDIF
  81.      sparkie.xpos := sparkie.xpos+getZBXYx(zbxy)
  82.      sparkie.ypos := sparkie.ypos+getZBXYy(zbxy)
  83.      IF (screen.picxoffset = 320) THEN direction := -2
  84.      IF (screen.picxoffset = 0) THEN direction := 2
  85.      screen.picxoffset := screen.picxoffset+direction
  86.      Move_Picture(screen)
  87.      Wait_OSVBL()
  88.      Update_Sprite(screen,sparkie)
  89.        UNTIL !(zbxy AND MB_LMB)
  90.  
  91.       FreeMemBlock(sparkie.data);
  92.       ENDIF
  93.      ENDIF
  94.      Delete_Screen(screen)        
  95.     ENDIF
  96.    CloseLibrary(gmsbase)
  97.    ENDIF
  98. ENDPROC
  99.  
  100.